/**
 * Copyright (c) 2024-2025 National Fundamental Software of China Co., Ltd.
 *
 * You should have find a copy of NFSChina License. If not, please contact us
 * by email <os_support@nfschina>
 *
**/

import QtQuick 2.5
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.1

import org.kde.kirigami 2.5 as Kirigami

Rectangle {
    id: root

    property alias kcmIcon: iconItem.source
    property alias kcmName: label.text
    property alias lineColor: spaceline.color
    property int index: -1
    property string plugin: ""
    // height: 46

    color: "transparent"
//    RowLayout {
//        id: row

        height: root.height - 1
        anchors {
            top: root.top
            left: root.left
            right: root.right
        }

        Kirigami.Icon {
            id: iconItem
            anchors.left: parent.left
            anchors.leftMargin: 23

            height: 16
            width: 16
            source: kcmIcon
        }

        QQC2.Label{
            id: label
            anchors.left: iconItem.right
            anchors.leftMargin: 23
            text: kcmName
            font.pixelSize: 14
            color: textcolor
            font.family: "SourceHanSansSC-Regular"
        }

        Kirigami.Icon {
            anchors.top: parent.top
            anchors.topMargin: 15
            anchors.left: parent.left
            anchors.leftMargin: 498

            height: 16
            width: 16
            source: "go-next-symbolic"
        }
   // }

    Rectangle{
        id: spaceline

        anchors.bottom: root.bottom
        width: root.width
        color: "red"
        height: 1
    }

    MouseArea {
        anchors.fill: parent
        onClicked:  {
            console.log("------current index:", root.index)
            kcm.openKCM(plugin)
        }
    }
}

